#include "headfiles.h"

using namespace std;

int main(int argc, char **argv) {
    if (argc != 3) {
        cout << "Usage: " << argv[0] << " row column" << endl;
        return 0;
    }

    int m = atoi(argv[1]);
    int n = atoi(argv[2]);

    //char **matrix = (char **)twoDMalloc(m, n, sizeof(char));
    char **matrix = template2DMalloc<char>(m, n);
    int i, j;
    for (i = 0; i < m; i++) {
        for (j = 0; j < n; j++) {
            matrix[i][j] = i * n + j;
        }
    }

    cout << "The matrix is:" << endl;
    for (i = 0; i < m; i++) {
        for (j = 0; j < n; j++) {
            cout << (int)matrix[i][j] << "\t";
        }
        cout << endl;
    }

    cout << endl;

    template2DFree(matrix);

    return 0;
}
